From 30fa06feac15609fe99657e02d171e024e825322 Mon Sep 17 00:00:00 2001
From: sergio <33748103+colado@users.noreply.github.com>
Date: Mon, 29 Dec 2025 23:45:36 +0200
Subject: feat(mobile): create new list edit screen (#2310)

* feat(mobile): create new edit screen and path

* refactor(mobile): use correct import for back navigation

* refactor(mobile): remove set state for list type

* feat(mobile): handle loading state

* feat(mobile): add error handling

* feat(mobile): add local validation for empty list name

* refactor(mobile): use correct param name in edit path

* feat(mobile): handle all pending state cases

* refactor(mobile): remove unnecessary return

* refactor(mobile): move type validation to top of the file

* refactor(mobile): revert validation order

* refactor(mobile): clean up submit values

* fix(mobile): fix button views
---
 apps/mobile/app/dashboard/lists/[slug].tsx | 135 -----------------------------
 1 file changed, 135 deletions(-)
 delete mode 100644 apps/mobile/app/dashboard/lists/[slug].tsx

(limited to 'apps/mobile/app/dashboard/lists/[slug].tsx')

diff --git a/apps/mobile/app/dashboard/lists/[slug].tsx b/apps/mobile/app/dashboard/lists/[slug].tsx
deleted file mode 100644
index e7aab443..00000000
--- a/apps/mobile/app/dashboard/lists/[slug].tsx
+++ /dev/null
@@ -1,135 +0,0 @@
-import { Alert, Platform, View } from "react-native";
-import * as Haptics from "expo-haptics";
-import { router, Stack, useLocalSearchParams } from "expo-router";
-import UpdatingBookmarkList from "@/components/bookmarks/UpdatingBookmarkList";
-import FullPageError from "@/components/FullPageError";
-import CustomSafeAreaView from "@/components/ui/CustomSafeAreaView";
-import FullPageSpinner from "@/components/ui/FullPageSpinner";
-import { api } from "@/lib/trpc";
-import { MenuView } from "@react-native-menu/menu";
-import { Ellipsis } from "lucide-react-native";
-
-import { ZBookmarkList } from "@karakeep/shared/types/lists";
-
-export default function ListView() {
-  const { slug } = useLocalSearchParams();
-  if (typeof slug !== "string") {
-    throw new Error("Unexpected param type");
-  }
-  const {
-    data: list,
-    error,
-    refetch,
-  } = api.lists.get.useQuery({ listId: slug });
-
-  return (
-    <CustomSafeAreaView>
-      <Stack.Screen
-        options={{
-          headerTitle: list ? `${list.icon} ${list.name}` : "",
-          headerBackTitle: "Back",
-          headerLargeTitle: true,
-          headerRight: () => (
-            <ListActionsMenu listId={slug} role={list?.userRole ?? "viewer"} />
-          ),
-        }}
-      />
-      {error ? (
-        <FullPageError error={error.message} onRetry={() => refetch()} />
-      ) : list ? (
-        <View>
-          <UpdatingBookmarkList
-            query={{
-              listId: list.id,
-            }}
-          />
-        </View>
-      ) : (
-        <FullPageSpinner />
-      )}
-    </CustomSafeAreaView>
-  );
-}
-
-function ListActionsMenu({
-  listId,
-  role,
-}: {
-  listId: string;
-  role: ZBookmarkList["userRole"];
-}) {
-  const { mutate: deleteList } = api.lists.delete.useMutation({
-    onSuccess: () => {
-      router.replace("/dashboard/lists");
-    },
-  });
-
-  const { mutate: leaveList } = api.lists.leaveList.useMutation({
-    onSuccess: () => {
-      router.replace("/dashboard/lists");
-    },
-  });
-
-  const handleDelete = () => {
-    Alert.alert("Delete List", "Are you sure you want to delete this list?", [
-      { text: "Cancel", style: "cancel" },
-      {
-        text: "Delete",
-        onPress: () => {
-          deleteList({ listId });
-        },
-        style: "destructive",
-      },
-    ]);
-  };
-
-  const handleLeave = () => {
-    Alert.alert("Leave List", "Are you sure you want to leave this list?", [
-      { text: "Cancel", style: "cancel" },
-      {
-        text: "Leave",
-        onPress: () => {
-          leaveList({ listId });
-        },
-        style: "destructive",
-      },
-    ]);
-  };
-
-  return (
-    <MenuView
-      actions={[
-        {
-          id: "delete",
-          title: "Delete List",
-          attributes: {
-            destructive: true,
-            hidden: role !== "owner",
-          },
-          image: Platform.select({
-            ios: "trash",
-          }),
-        },
-        {
-          id: "leave",
-          title: "Leave List",
-          attributes: {
-            destructive: true,
-            hidden: role === "owner",
-          },
-        },
-      ]}
-      onPressAction={({ nativeEvent }) => {
-        if (nativeEvent.event === "delete") {
-          handleDelete();
-        }
-        if (nativeEvent.event === "leave") {
-          handleLeave();
-        }
-      }}
-      shouldOpenOnLongPress={false}
-    >
-      <Ellipsis onPress={() => Haptics.selectionAsync()} color="gray" />
-    </MenuView>
-  );
-}
-- 
cgit v1.3-1-g0d28

